﻿package gui.hug;

import flash.text.TextField;

class HUGSquareBlueButtonDS extends HUGSprite {

	public function new(state : UInt, label : String, w : Float, h : Float) {
		super();
		var bc : UInt = 0x3b6798; // Border Color

		var bgc : UInt = 0; // BackGround Color
		var ibc : UInt = 0; // Inner Border Color
		var tlc : UInt = 0; // Top Line Color

		var tc : UInt = 0; // Text Color
		var tsc : UInt = 0; // Text Shadow Color

		tlc = 0x3b6798;
		tc = 0xffffff;
		tsc = 0x45688e;

		switch (state) {
			case 1 :  // Over state
				bgc = 0x84a1bf;
				tlc = 0x92acc7;
				ibc = 0x7293b7;
			case 2 :  // Down state
				bc = 0x3a6595;
				bgc = 0x6688ad;
				tlc = 0x7495b8; // Should be drawn as bottom line.
				ibc = 0x51769e;
			default :  // Out state
				bgc = 0x6d8fb3;
				tlc = 0x7e9cbc;
				ibc = 0x5c82ab;
		}

		var xx : UInt = (w == 0) ? 10  :  0;
		var fs : UInt = 11; // Font Size

		var txt1 : TextField = Utils.addText(xx, 0, w, fs, label, tsc, Utils.TXT_CENTER);
		var txt2 : TextField = Utils.addText(xx, 0, w, fs, label, tc , Utils.TXT_CENTER);

		if (w == 0)
			w = txt1.textWidth + 24;

		txt2.y = Math.round((h - txt1.textHeight) / 2) - 2;
		txt1.y = txt2.y + 1;

		Utils.rect(this, 0, 0, w, h, bgc, bc);
		Utils.hollowRect(this, 1, 1, w - 2, h - 2, ibc);
		if (state == 2)
			Utils.horLine(this, 2, w - 2, h - 1, tlc);
		else
			Utils.horLine(this, 1, w - 1, 1, tlc);

		addChild(txt1);
		addChild(txt2);
	}
}
